package com.neu.wangxiaoyang.servlet;

import com.neu.wangxiaoyang.service.VisitDelService;

import javax.naming.Context;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.util.Map;

@WebServlet(name = "DelVisitServlet", urlPatterns = {"/DelVisitServlet.do"})
public class DelVisitServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        Map<String ,String []>map=request.getParameterMap();
        VisitDelService vs=new VisitDelService();
        int row=vs.Delete(map);
            if(row>0){
                System.out.println("删除成功");
                response.sendRedirect(request.getContextPath()+"/commons/success.jsp");
            }else{
                System.out.println("删除失败");
            }
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doPost(request, response);
    }
}
